<script setup lang="ts">
import { onMounted, reactive } from 'vue';
const props: any = defineProps<{
    ujt: any;
}>();

const { $global, $fn } = props.ujt;
const kudududata: any = reactive({
    hash: 'robot/indexslam',
});

onMounted(() => {
    // 搜索功能
    document.getElementById('kdd-searchInput').addEventListener('keypress', (e) => {
        if (e.key === 'Enter') {
            const keyword = e.target.value.trim();
            if (keyword) {
                alert(`执行搜索：${keyword}`);
                // 实际搜索逻辑
            }
        }
    });

})
</script>

<template>
    <section class="kdd-li-area">
        <div class="kdd-search-box">
            <input type="text" id="kdd-searchInput" placeholder="搜索行业资讯...">
        </div>

        <div class="kdd-li-category">
            <div class="kdd-li-category-item">技术动态</div>
            <div class="kdd-li-category-item">产品发布</div>
            <div class="kdd-li-category-item">企业动态</div>
            <div class="kdd-li-category-item">行业报告</div>
        </div>

        <div class="news-list">
            <div class="news-kdd-card">
                <div class="news-color-block"
                    style="width: 100%; height: 150px; background: var(--bg-gradient); margin-bottom: 1rem;"></div>
                <h3>📰 最新机器人技术突破</h3>
                <p>某公司宣布在机器人智能控制领域取得重大突破，将推动行业发展。</p>
            </div>
            <div class="news-kdd-card">
                <div class="news-color-block"
                    style="width: 100%; height: 150px; background: var(--bg-gradient); margin-bottom: 1rem;"></div>
                <h3>📰 新型机器人产品发布</h3>
                <p>一款全新的工业机器人正式发布，具备更高的精度和效率。</p>
            </div>
            <div class="news-kdd-card">
                <div class="news-color-block"
                    style="width: 100%; height: 150px; background: var(--bg-gradient); margin-bottom: 1rem;"></div>
                <h3>📰 机器人企业战略合作</h3>
                <p>两家领先的机器人企业达成战略合作，共同开拓市场。</p>
            </div>
            <div class="news-kdd-card">
                <div class="news-color-block"
                    style="width: 100%; height: 150px; background: var(--bg-gradient); margin-bottom: 1rem;"></div>
                <h3>📰 行业年度报告发布</h3>
                <p>权威机构发布了智能机器人行业年度报告，解读行业趋势。</p>
            </div>
        </div>

        <div class="kdd-li-page">
            <div class="kdd-li-page-item">1</div>
            <div class="kdd-li-page-item">2</div>
            <div class="kdd-li-page-item">3</div>
            <div class="kdd-li-page-item">...</div>
            <div class="kdd-li-page-item">10</div>
        </div>
    </section>
</template>

<style scoped lang="scss">
/* 主内容区 */
.kdd-li-area {
    min-height: calc(100vh - var(--nav-height));
    padding: var(--nav-height) 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: radial-gradient(circle at center,
            rgba(0, 247, 255, 0.1) 0%,
            rgba(10, 10, 46, 1) 70%);
}

/* 搜索框 */
.kdd-search-box {
    width: min(90%, 700px);
    position: relative;
    margin: 2rem 0;
}

#kdd-searchInput {
    width: 100%;
    padding: 1.2rem 2rem;
    border: 2px solid var(--primary);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    backdrop-filter: blur(5px);
    transition: 0.3s;
}

#kdd-searchInput:focus {
    outline: none;
    box-shadow: 0 0 30px var(--primary);
}

/* 分类列表 */
.kdd-li-category {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.kdd-li-category-item {
    background: var(--bg-gradient);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: 0.3s;
}

.kdd-li-category-item:hover {
    transform: scale(1.1);
}

/* 资讯列表 */
.news-list {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 2rem;
}

.news-kdd-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid rgba(0, 247, 255, 0.2);
    transition: 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.news-kdd-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            transparent,
            var(--primary),
            transparent);
    transform: rotate(45deg);
    transition: 0.5s;
    opacity: 0;
}

.news-kdd-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 247, 255, 0.3);
}

.news-kdd-card:hover::before {
    opacity: 0.3;
    animation: kddBorderFlow 3s linear infinite;
}

@keyframes kddBorderFlow {
    0% {
        transform: rotate(45deg) translate(-30%, -30%);
    }

    100% {
        transform: rotate(45deg) translate(30%, 30%);
    }
}

/* 分页 */
.kdd-li-page {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.kdd-li-page-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: 0.3s;
}

.kdd-li-page-item:hover {
    background: var(--bg-gradient);
}

/* 页脚 */
.kdd-footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 3rem 20px;
    text-align: center;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .kdd-nav-menu {
        position: fixed;
        top: var(--nav-height);
        right: -100%;
        flex-direction: column;
        background: rgba(10, 10, 46, 0.95);
        width: min(300px, 80%);
        padding: 2rem;
        backdrop-filter: blur(10px);
        border-radius: 0 0 0 20px;
    }

    .kdd-nav-menu.active {
        right: 0;
    }

    .kdd-menu-toggle {
        display: block;
    }

    .news-kdd-card {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    :root {
        --nav-height: 50px;
    }

    .kdd-logo {
        font-size: 1.5rem;
    }

    .kdd-li-area {
        min-height: 80vh;
    }

    #kdd-searchInput {
        padding: 1rem 1.5rem;
    }

    .news-list {
        margin: 3rem auto;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .kdd-nav-bar {
        padding: 0 15px;
    }

    .news-kdd-card h3 {
        font-size: 1.1rem;
    }

    .news-kdd-card p {
        font-size: 0.9rem;
    }

    .kdd-footer {
        padding: 2rem 15px;
    }
}
</style>
